package version

import (
	"go-fiber-ip2region/model/common/response"

	"github.com/gofiber/fiber/v2"
)

type VersionGetApi struct{}

// @Tags version
// @Summary 获取版本
// @Success 200 {object} response.VersionInfoRes
// @Router /version [get]
func (v *VersionGetApi) GetVersion(c *fiber.Ctx) error {
	verInfo, err := versionService.GetVersionInfo()

	if err != nil {
		return c.Status(fiber.StatusBadGateway).JSON(response.ErrorResponse{Message: string(err.Error())})
	}

	return c.JSON(verInfo)
}
